package com.lyrcsoft.controller;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.servlet.function.RouterFunction;
import org.springframework.web.servlet.function.ServerResponse;

import static org.springframework.web.servlet.function.RequestPredicates.accept;
import static org.springframework.web.servlet.function.RouterFunctions.route;

/**
 * @author fujc-dev@qq.com
 * @date 2023/7/15 10:18
 */
@Configuration
public class RouterFunctionHandler {
    @Bean
    public RouterFunction<ServerResponse> hello() {
        return route().GET("/hello", accept(MediaType.APPLICATION_JSON),
                request -> {
                    System.out.println("hello");
                    return ServerResponse.status(HttpStatus.OK).body("");
                }).build();

    }
}
